/*package com.utils.file;

public class muiltUploadFile {

}

<%@page import="com.huateng.toprules.core.system.entity.SysOperateLog"%><%@include file="../common/jsp/UsrCheck.jsp"%>
<%@page contentType="text/html;charset=GBK"%>
<%@page import="com.sinosoft.utility.*"%>
<%@page import="com.sinosoft.lis.pubfun.*"%>
<%@page import="com.sinosoft.lis.schema.*"%>
<%@page import="com.sinosoft.lis.vschema.*"%>
<%@page import="com.sinosoft.lis.agentprint.*"%>
<%@page import="com.crg.lis.db.*"%>
<%@page import="com.crg.lis.schema.*"%>
<%@page import="com.crg.lis.service.*"%>
<%@page import="com.crg.lis.common.*"%>
<%@page import="com.crg.lis.ws.*"%>
<%@page import="java.io.*"%>
<%@page import="java.text.*"%>
<%@page import="java.util.*"%>
<%@page import="org.apache.commons.fileupload.*"%>

<% 	
	GlobalInput tG = new GlobalInput();
	tG=(GlobalInput)session.getValue("GI");
	
	//归属文件 （后期功能设计中添加）
	String belongFile = (String)request.getParameter("blackfiletypeCo");
	
	Date d = new Date();
	SimpleDateFormat sdf = new SimpleDateFormat("HH-mm-ss_yyyy-MM-dd"); //获取当前时间
	String strd = sdf.format(d);
	String strdate = strd.substring(strd.lastIndexOf("_")+1,strd.length());

	//从配置文件里获取导入上传压缩文件后的存放路径
	Locale locale1 = new Locale("zh", "CN"); 
	ResourceBundle resource = ResourceBundle.getBundle("path",locale1);
	String path = resource.getString("upload")+"\\"+belongFile;	
	String path1 = path.replace('\\','/');
	System.out.println("导入上传压缩文件后的存放路径path:"+path);
	String path2= path1;
	if(!path1.endsWith("/")){
		path2= path1+ "/";
	}

	//从配置文件里获取解压缩文件后的存放路径 
	String unPath = resource.getString("rootPath");	
	String unPath1 = unPath.replace('\\','/');
	System.out.println("解压缩文件后的存放路径unPath:"+unPath);
	String unPath2= unPath1;
	//System.out.println("unPath1:"+unPath1);
	if(!unPath1.endsWith("/")){
		unPath2= unPath1+ "/";
	}
	//System.out.println("unPath2:"+unPath2);	
	DiskFileUpload fu = new DiskFileUpload();
	// 设置允许用户上传文件大小,单位:字节
	//fu.setSizeMax(1*1024*1024);
	// maximum size that will be stored in memory?
	// 设置最多只允许在内存中存储的数据,单位:字节
	//fu.setSizeThreshold(4*1024);
	// 设置一旦文件大小超过getSizeThreshold()的值时数据存放在硬盘的目录
	//fu.setRepositoryPath(path+"/temp");
	//开始读取上传信息
	List fileItems = fu.parseRequest(request);
	String FileName = "";
	String FlagStr = "Fail";
	String Content = "";

	// 依次处理每个上传的文件
	Iterator iter = fileItems.iterator();
	int count=0;
	while (iter.hasNext())
	{
		FileItem item = (FileItem) iter.next();
		
		//忽略其他不是文件域的所有表单信息
		if (!item.isFormField())
		{
			String name = item.getName();
			long size = item.getSize();
			if((name==null||name.equals("")) && size==0)
				continue;
			
			FileName = name.replace('\\','/');
			FileName = FileName.substring(FileName.lastIndexOf("/") + 1);
			//System.out.println("FileName="+FileName);		
			if(FileName.toLowerCase().endsWith(".zip") == false){
			    Content = "上传文件失败!只能上传zip压缩文件！";
		        FlagStr = "Fail";
			    continue;
			}
			//删除已解压的文件（删除了整个文件夹，然后重新建）（删除不是今天的文件 如果删除不掉就留着）
		 	deleteFiletool.deleteDirectoryTwo(path,strdate);  
			//创建保存解压文件的目录
			File f2 = new File(path);
			//System.out.println("f2.exists()="+f2.exists());
			if(!f2.exists()){
				f2.mkdir();
				System.out.println("创建成功！");
			}
			//保存上传的文件到指定的目录			
			try
			{
				//System.out.println("修改后的FileName="+path2 + FileName.toUpperCase().replace(".ZIP","_"+strd+".zip"));
				item.write(new File(path2 + FileName.toUpperCase().replace(".ZIP","_"+strd+".zip")));
				count = 1;				
			}
			catch(Exception e){
				Content = "文件上传失败！原因："+e.getMessage();
		        FlagStr = "Fail";
				System.out.println("upload file error ..."+e.getMessage());
			}
		}
		if(count==1){
			//删除已解析过的文件（删除了整个文件夹，然后重新建）
		 	deleteFiletool.deleteDirectory(unPath); 
			//创建保存解压文件的目录
			File f1 = new File(unPath);
			if(!f1.exists()){
				f1.mkdir();
				System.out.println("创建成功！");
			}
			
			//将解压缩后的文件存放到指定的目录（unPath）
			System.out.println("解压开始！");
			ZipUtil zipUtil = new ZipUtil();
			zipUtil.unZip(path2 + FileName.toUpperCase().replace(".ZIP","_"+strd+".zip"),unPath);
			System.out.println("解压结束！");
			System.out.println("调用解析xml、txt黑名单文件的方法-----------------start");
			blackDataInfoService blackDataInfoService = new blackDataInfoService();
			unPath = blackDataInfoService.directoryPath(unPath);
			//System.out.println("unPath路径="+unPath);
			blackDataInfoService.VersionIsExist("本地://"+belongFile+"//"+FileName,unPath);	
			System.out.println("调用解析xml、txt黑名单文件的方法-----------------end");
			
			//删除已解析过的文件（删除了整个文件夹）
		 	deleteFiletool.deleteDirectory(unPath);	
			//删除  今天以外的 已解压的文件（删除了整个文件夹）  如果删除不掉就留着	 	
		 	deleteFiletool.deleteDirectoryTwo(path,strdate);
		 	//删除以解压的文件 如果删除不掉就留着	
		 	//deleteFiletool.deleteDirectory(path);
			System.out.println("删除完毕...");
		 	FlagStr="Succ";
			Content ="保存数据成功！";			
		}
		else{
			FlagStr="Fail";
			Content ="保存数据失败！";
		}
	}
				
%>
<script language="javascript">	
	parent.fraInterface.afterSubmit("<%=FlagStr%>","<%=Content%>");
</script>

----------------------------------------------------------
<%@include file="../common/jsp/UsrCheck.jsp"%>
<%@page contentType="text/html;charset=GBK" %>
<html> 
	<head>
		<%
  			GlobalInput tGI1 = new GlobalInput();
  			tGI1=(GlobalInput)session.getValue("GI");//添加页面控件的初始化。
  
 		%>

		<script>
	 		var comcode = "<%=tGI1.ComCode%>";
		</script>
		<meta http-equiv="Content-Type" content="text/html; charset=GBK">
	  	<SCRIPT src="../common/javascript/MulLine.js"></SCRIPT>
	  	<LINK href="../common/css/Project.css" rel=stylesheet type=text/css>
	  	<SCRIPT src="../common/easyQueryVer3/EasyQueryCache.js"></SCRIPT>
	  	<SCRIPT src="../common/easyQueryVer3/EasyQueryVer3.js"></SCRIPT>
	  	<SCRIPT src="../common/javascript/Common.js" ></SCRIPT>
	  	<SCRIPT src="../common/cvar/CCodeOperate.js"></SCRIPT>
	  	<SCRIPT src="../common/Calendar/Calendar.js"></SCRIPT>
	  	<SCRIPT src="../common/javascript/VerifyInput.js"></SCRIPT> 
	  	<SCRIPT src="blackListManualImport.js"></SCRIPT>  
	  	<LINK href="../common/css/Project.css" rel=stylesheet type=text/css>
	  	<LINK href="../common/css/mulLine.css" rel=stylesheet type=text/css>
	   	<%@include file="blackListManualImportInit.jsp"%>
  
  	<title>黑名单手工导入</title>   
	</head>
  	<body onload="initForm();initElementtype();">

<br>

<form id="fm" name="fm" method="post" action="" target="fraSubmit" ENCTYPE="multipart/form-data">
	<Table>
        <TR>
            <TD class=common><IMG  src= "../common/images/butExpand.gif" style= "cursor:hand;" OnClick= "showPage(this,divLDPerson);"></TD>
            <TD class= titleImg> 黑名单手工导入 </TD>
        </TR>
    </Table>
        
    <Div  id= "divLDPerson" style= "display: ''" align= center>
        <Table  class= common>
            <TR class= common>
            <TD  class= title>归属文件</TD>
				<TD  class= input>
              <Input class='codeno' name=blackfiletype  ondblClick="return showCodeList('blackfiletype',[this,blackfiletypeCo],[0,1],null,'','');"  
              onkeyup="return showCodeListKey('blackfiletype',[this,blackfiletypeCo],[0,1]);"><input class=codename name=blackfiletypeCo verify="归属文件|notnull" readonly=true elementtype=nacessary>
          	</TD>
            </TR>
            <TR class= common>
            	<TD  class= title>导入文件</TD>
            	<input type=hidden name=ImportPath value='upload/'>
            	<td class= input>
            	<Input verify="导入文件|notnull" type="file" id=fileName name=fileName size=30 elementtype=nacessary>
            	</td>
            </TR>
        </Table>
    </Div> 
    <table> 
        <tr>    
            <td class=common> 
             <INPUT class=cssButton VALUE="导 入" TYPE=button onClick="importFile();">  
            </td>
        	<TD class=common>
             <input class=cssbutton type=button value="重 置" onclick="return clearData();">
            </TD>
    </table>
    			<span id="spanCode" style="display: none; position: absolute;"></span>
    </form>
  	</body>
</html>
*/